<?php get_header(); ?>

<!-- PRIMARY CONTENT (start) -->
		
<div id="primary">

    <div id="portfolio">
        <div class="pad">

            <?php themeblvd_breadcrumbs(); ?>

            <!-- Get Term Info -->
            <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
            <?php $term_name = $term->name; ?>
            <?php $term_slug = $term->slug; ?>

            <?php if($themeblvd_portfolio_page_title != 'false') :?>
            <h2 class="page-title"><?php echo $term_name; ?></h2>
            <?php endif; ?>

            <?php $post_num = 1; ?>

            <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
            <?php query_posts("paged=$paged&portfolio=$term_slug&posts_per_page=$themeblvd_items_per_page"); ?>
            <!-- Start the Loop -->
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

            <?php
            //Item to pass into themeblvd_media()
            $input = get_post_meta($post->ID, 'themeblvd_media_item', true);
            $autostart = 1;
            $color = $themeblvd_media_color;
            $logo = $themeblvd_video_logo;
            $logo_width = $themeblvd_video_logo_width;
            $logo_height = $themeblvd_video_logo_height;

            $media_link = themeblvd_media($input, $autostart, $color, $logo, $logo_width, $logo_height);
            ?>

            <div class="portfolio-box">

                <!-- Item Thumbnail -->
                <?php if($themeblvd_thumbnail == 'false') : ?>
                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="item">
                <?php else : ?>
                <a href="<?php echo $media_link; ?>" title="<?php the_title(); ?>" class="thumb thumb-media loader" rel="lightbox[gallery]">
                <?php endif; ?>
                    
                    <?php if ( has_post_thumbnail() ) : ?>
                        <?php the_post_thumbnail('portfolio', array("class" => "pretty")); ?>
                    <?php else : ?>
                        <p><?php _e('Oops! You forgot set a featured image.', 'themeblvd'); ?></p>
                    <?php endif; ?>

                </a>

                <!-- Item Title -->
                <?php if($themeblvd_show_title == 'true') : ?>
                <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
                <?php endif; ?>

                <!-- Item Excerpt -->
                <?php if($themeblvd_show_excerpt == 'true') : ?>
                    <?php the_excerpt(); ?>
                <?php endif; ?>

                <!-- Item Read More Link -->
                <?php if($themeblvd_show_read_more == 'true') : ?>
                <p><a href="<?php the_permalink(); ?>" class="button" title="<?php the_title(); ?>">Read More</a></p>
                <?php endif; ?>

            </div><!-- .portfolio-box (end) -->

            <?php if($post_num % 3 == 0) : ?>
            <!-- Clear floats every 3 divs -->
            <div class="clear"></div>
            <?php endif; ?>

            <?php $post_num++; ?>

            <?php endwhile; ?>

            <div class="clear"></div>

            <!-- Pagination -->
            <?php themeblvd_pagination(); ?>

            <?php else: ?>

            <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>

            <?php endif; ?>


        </div><!-- .pad (end) -->
    </div><!-- #full-width-content (end) -->

<?php get_footer(); ?>